﻿/*
=============================================================================
Author:魏宝辉通过CodeSmithe生成
CreatedTime:2012-12-12
Description:UserGroup三层结构数据访问层
=============================================================================
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using PWMIS.DataMap.Entity;
using FTchina.Models;//引入模型层
namespace FTchina.DAL
{
	public static partial class UserGroupService
	{
		 
	 
			
		public static int DeleteUserGroupById(int id)	
		{     
            UserGroup userGroup = new UserGroup();
            userGroup.Id = id;
            EntityQuery<UserGroup> query = new EntityQuery<UserGroup>(userGroup);
             return query.Delete(userGroup);
		}	
        
          //以标识列获得对象
        public static UserGroup GetUserGroupById(int  id)
        {
            UserGroup userGroup = new UserGroup();
            userGroup.Id = id;
            EntityQuery<UserGroup> query = new EntityQuery<UserGroup>(userGroup);
            query.FillEntity(userGroup);
            return userGroup;
        }
		
	 
	 
       
        
        
        
		 
		 
		 public static int AddOrUpdateUserGroup(UserGroup userGroup)
        {
            UserGroup _userGroup = new UserGroup();

            EntityQuery<UserGroup> query = new EntityQuery<UserGroup>(_userGroup);
           _userGroup= userGroup;
           int i=(userGroup.Id==0)?
                 query.Insert(_userGroup): query.Update(_userGroup);
            return i;
        }
		
		 
	}
}

